import { del, get, post } from "../utils/request";

//获取轮播图数据
export const loadBannerApi = () => get("/api/v1/banners");

//获取商品分类
export const loadProductCategoriesApi = () => get("/api/v1/product_categories");

// 获取商品信息
export const loadProductsApi = (params = {}) => get("/api/v1/products", params);

// 获取商品详情
export const loadProductDetailApi = (id) => get("/api/v1/products/" + id);

// 加入购物车  data ：三个参数
/**
 * @param {*} data
 * product 商品id
 * amount 数量 如果是减传-1
 * price  价格
 * @returns
 */
export const addToCartApi = (data) => post("/api/v1/shop_carts", data);

//获取购物车数据
export const loadCartApi = () => get("/api/v1/shop_carts");

//删除购物车商品
export const delFromCartApi = (id) => del("/api/v1/shop_carts/" + id);
